<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div></div>
  <div></div>
  <div></div>
  <div></div>
  <div></div>
  <script src="./node_modules/jquery/dist/jquery.js"></script>
  <script>
    //IE8不支持
    ;['abc','d','efg'].forEach(function (item,index) {
      console.log(item)
    })

    //遍历jQuery元素
    $.each([1,2,3,34], function (index, item) {
      console.log(item)
    })

    console.log(typeof $('div'))
    //伪数组是对象，对象的原型链中没有forEach

    //each是jQuery中提供的
    $('div').each(function (index, item) {
      console.log(item)
    })

    //each():方便遍历jQuery元素
    //可以在不兼容forEach()的低版本中使用each()

    ;[].slice.call($('div')).forEach(function (item) {
      console.log(item)
    })
  </script>
</body>
</html>